﻿using System;
using System.Collections.Generic;
using System.Linq;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
using Propulsion.iOS.Core;

namespace Propulsion.iOS
{
	[Register("AppDelegate")]
	public class AppDelegate : WaveEngine.Adapter.Application
	{
		private Game game;

		public override void Initialize()
		{
			game = new Game();
			game.Initialize(this);
		}

		public override void Update(TimeSpan elapsedTime)
		{
			game.UpdateFrame(elapsedTime);
		}

		public override void Draw(TimeSpan elapsedTime)
		{
			game.DrawFrame(elapsedTime);
		}

		public override void OnResignActivation(UIApplication application)
		{
			base.OnResignActivation(application);
			game.OnDeactivated();
		}

		public override void OnActivated(UIApplication application)
		{
			if (game != null)
			{
				game.OnActivated();
			}
			base.OnActivated(application);
		}
	}
}

